package com.syq.service.impl;


import com.syq.dao.AddressDao;
import com.syq.entity.Address;
import com.syq.service.AddressService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author wgy
 * @version V1.0
 * @project gp12_xiaomi
 * @package com.qf.service.impl
 * @description: ${TODO}
 * @date 2022/6/24 14:08
 */
@Service
@Transactional
public class AddressServiceImpl implements AddressService {
    private  static AddressDao addressDao;

    @Autowired
    public void setAddressDao(AddressDao addressDao) {
        this.addressDao = addressDao;
        System.out.println(addressDao);
    }

    @Override
    public List<Address> findByUid(Integer uid) {
        return addressDao.selectByUid(uid);
    }

    @Override
    public void add(Address address) {
        addressDao.insert(address);
    }

    @Override
    public void delete(int id) {
        addressDao.delete(id);
    }

    @Override
    public void update(Address address) {
        addressDao.update(address);
    }

    @Override
    public void updateLevel(int id,int uid) {
        addressDao.updateLevel0(uid);
        addressDao.updateLevel(id,uid);
    }

    @Override
    public Address findById(int aid) {
        return addressDao.selectById(aid);
    }
}
